<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="org.apache.shiro.web.filter.authc.FormAuthenticationFilter"%>
<%@ page import="org.apache.shiro.authc.ExcessiveAttemptsException"%>
<%@ page import="org.apache.shiro.authc.IncorrectCredentialsException"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html lang="en">
<head>
	<title>登录页</title>
	<script type="text/javascript" src="${ctx }/static/js/jquery-1.7.2.min.js"></script>
	<!-- bootstrap -->
	<link rel="stylesheet" type="text/css" media="screen"
		href="${ctx }/static/bootstrap/css/bootstrap.css">
	<link rel="stylesheet" type="text/css" media="screen"
		href="${ctx }/static/bootstrap/css/bootstrap-responsive.css">
	<SCRIPT type="text/javascript" src="${ctx }/static/js/jquery-ui-1.8.21.custom.min.js"></SCRIPT>
	<link type="text/css" href="${ctx }/static/css/flick/jquery-ui-1.8.21.custom.css" rel="stylesheet" />

<STYLE type="text/css">
</STYLE>
<SCRIPT type="text/javascript">
$(function() {
	
})
var check_pwd = function() {
	if( $("#pwd").val() != $("#repwd").val() ){
		var msg = $("#msg");
		msg.html("请确保两次输入密码一致");
		setTimeout(function() {
			msg.html("");
		}, 1500);
	}
}
var check_exist = function() {
	var u = $("#username").val();
	if(u.length == 0) {
		return ;
	}
	$.post("${ctx}/user/exist", {username: u}, function(data){
		if(data.flag == true) {
			$("#msg").html(u + "已经存在~");
			setTimeout(function(){
				$("#msg").html("");
			}, 1500);
		}
	}, 'json');
}
</SCRIPT>
</head>

<body>

<div class="container">
	<br/>
	<div class="row">
		<div class="span3">&nbsp;</div>
		<div class="span5 well" id="login">
			<FIELDSET class="form-horizontal">
				<legend>用户登录</legend>
				<LABEL id="msg">${msg }</LABEL><br/>
				<form:form id="loginForm" action="${ctx }/user/login" method="post">
					<div class="control-group">
						<LABEL class="control-label"><span></span>账　户：</LABEL>
						<div class="controls">
							<input class="xlarge" type="text" id="username" name="username" placeholder="用户名/邮箱/手机"/>
						</div>
					</div>
					<div class="control-group">
						<LABEL class="control-label">密　码：</LABEL>
						<div class="controls">
							<input class="xlarge" type="password" id="password" name="password" />
						</div>
					</div>
					<div class="control-group">
						<LABEL class="control-label">记住我：</LABEL>
						<div class="controls">
							<input type="checkbox" id="rememberMe" name="rememberMe"/>
						</div>
					</div>
					<div class="form-actions btn-groups">
						<input class="btn btn-large btn-success" type="submit" value="登录"/>
						<a class="btn btn-large" href="${ctx }/user/_regist">注册</a>
						<a href="${ctx }/user/home/forget_pwd?step=1">忘记密码</a>
					</div>
				</form:form>
			</FIELDSET>
		</div>
	</div>
</div>
</body>
</html>